package rad.framework.testing;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;

public class SampleInterceptor {

	@AroundInvoke
	public Object invoke(InvocationContext ctx) throws Exception {
		System.out.println("invoke: " + ctx.getTarget().getClass().getName()
				+ "." + ctx.getMethod().getName());
		return ctx.proceed();
	}

	@PostConstruct
	public void postConstruct(InvocationContext ctx) {
		System.out.println("postConstruct: " + ctx.getTarget());
	}

	@PreDestroy
	public void preDestroy(InvocationContext ctx) {
		System.out.println("preDestroy: " + ctx.getTarget());
	}
}
